import React from 'react'
import TagList from './components/taglist'
import Swiper1 from './components/swiper'
import Content from './components/content'
import TitleNav from './components/titlenav'
import { useEffect } from 'react'
import { connect } from 'react-redux'
import { getswiperlistAction, getMaintaglistAction, getYOULieklistAction } from '../../store/actions/rydata'

const Main = (props) => {
    const { list, taglist, swiperlist, navlist, getMaintaglistAction, getswiperlistAction, getYOULieklistAction } = props;
    useEffect(() => {
        getswiperlistAction();
        getMaintaglistAction();
        getYOULieklistAction()
    }, [getMaintaglistAction, getYOULieklistAction, getswiperlistAction])
    return <div>
        <Swiper1 swiperlist={swiperlist} />
        <TitleNav navlist={navlist} />
        <TagList taglist={taglist} />
        <Content list={list} />

    </div>
}

export default React.memo(connect(state => ({
    swiperlist: state.rydata.swiperlist || [],
    navlist: state.rydata.navlist || []
    , taglist: state.rydata.taglist || [],
    list: state.rydata.list || []
}), { getswiperlistAction, getMaintaglistAction, getYOULieklistAction })(Main))